package com.lq.demo.demo.mode.mycache;

import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;

/**
 * 缓存实体类
 *
 * @param <T> Obj
 */
public class EntitiCache<T> {


    /**
     * 缓存数据
     */
    private T data;

    /**
     * 缓存超时时间 默认5分钟
     */
    private long timeOut = 300000;

    /**
     * 缓存缓存时间
     */
    private long refreshTime;

    /**
     * 缓存描述
     */
    private String desc;

    /**
     * 缓存编号
     */
    private AtomicLong number;

    /**
     * 缓存名字
     */
    private String name;

    public EntitiCache() {
    }

    public EntitiCache(Object data, long timeOut, long refreshTime) {
        this.data = (T) data;
        this.timeOut = timeOut;
        this.refreshTime = refreshTime;
    }

    public EntitiCache(Object data, long refreshTime) {
        this.data = (T) data;
        this.refreshTime = refreshTime;
    }


    public long getTimeOut() {

        return timeOut;
    }

    public void setTimeOut(long timeOut) {
        this.timeOut = timeOut;
    }

    public long getRefreshTime() {
        return refreshTime;
    }

    public void setRefreshTime(long refreshTime) {
        this.refreshTime = refreshTime;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public AtomicLong getNumber() {
        return number;
    }

    public void setNumber(AtomicLong number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {

        this.name = name;
    }

    @Override
    public String toString() {
        return "EntitiCache{" +
                "data=" + data +
                ", timeOut=" + timeOut +
                ", refreshTime=" + refreshTime +
                ", desc='" + desc + '\'' +
                ", number=" + number +
                ", name='" + name + '\'' +
                '}';
    }
}
